package cn.clwxy.gdz.dao;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanHandler;

import cn.clwxy.gdz.entity.Comment;
import cn.clwxy.gdz.util.BaseDao;

public class CommentDaoImpl extends BaseDao implements CommentDao {

	@Override
	public int addComment(Comment comment) {
		String sql = "INSERT into `comment`(commentType,beCommentId,commentContents,commentTime,reciewer,reviewerId)"
				+ "VALUE(?,?,?,?,?,?)";
		Object obj[]={comment.getCommentType(),comment.getBeCommentId(),comment.getCommentContents(),comment.getCommentTime(),comment.getReciewer(),comment.getReviewerId()};
		return super.update(sql, obj);
	}

	@Override
	public int deleteComment(Integer id) {
		String sql = "DELETE FROM `comment` WHERE id=?";
		return super.update(sql, id);
	}

	@Override
	public int updateComment(Comment comment) {
		// TODO Auto-generated method stubno
		return 0;
	}

	@Override
	public List<Comment> getCommentByDate() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Comment getCommentById(Integer id) {
		String sql = "SELECT*FROM `comment` WHERE comment.id=?";		
		return super.querySingle(sql, new BeanHandler<Comment>(Comment.class), id);
	}

	@Override
	public Long getCommentCount() {
		// TODO Auto-generated method stubno
		return null;
	}

}
